// pages/zhuanjiematongji/zhuanjiematongji.js
const app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    shiquxuan:'',
  },


    //网点
    bouut() {
      this.setData({
        openid: app.globalData.openid,
        jiami: app.globalData.jiami,
        OPEN_ID: app.globalData.openid,
        session_key: app.globalData.session_key,
      })
      wx.request({
        url: app.globalData.interface+'/management/API3_1017_ZhuanJieRenList',
        method: 'POST',
        data: {
  
          OPEN_ID: this.data.OPEN_ID, //用户OPEN_ID
          session_key: this.data.session_key,
          OPEN_UUID: this.data.jiami,

        },
        header: {
          'content-type': 'application/x-www-form-urlencoded'
        },
        success: res => {
          console.log(res.data.data);

          let that =this
     
          const shusp = res.data.data
          const liscop = shusp.map((item) => {
            // console.log(liscop);
              return {
                ...item,
                CUSTOMER_TEL: item.CUSTOMER_TEL.substr(0, 3) + "****" + item.CUSTOMER_TEL.substr(7),
                CUSTOMER_NAME:"*" + item.CUSTOMER_NAME.substr(1),
              }
    
          })

          console.log(liscop);

          that.setData({
            shiquxuan: liscop
          })


















          wx.showModal({
            title: '温馨提示',
            content: res.data.data,
            success: function (res) {
              if (res.confirm) { //这里是点击了确定以后
                console.log('用户点击确定')
                that.setData({
                  shiquxuan: true
                })
                that.sihuodong()
              } else { //这里是点击了取消以后
                console.log('用户点击取消')
                that.sihuodong()
                that.setData({
                  shiquxuan: true
                })
              }
            }
          })
        }
      })
    },
  
  

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {


  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
    this.setData({

      openid: app.globalData.openid,
      jiami: app.globalData.jiami,
      OPEN_ID: app.globalData.openid,
      session_key: app.globalData.session_key,
    })
    // this.sihuodong()


    setTimeout(() => {

      this.bouut()

    }, 800)
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})